<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<div class="easyui-layout" style="width:100%;height:100%;" fit="true">
    <div data-options="region:'center',title:'',split:true" style="height:100%;">
		<form id="mPassPolicyInfoForm" method="post" >
			<table class="detailTable"> 
    	 	<tr>
                <th>有效天数:</th> 
                <td>
                	<input class="easyui-numberbox" id="validDay" name="validDay"  data-options="required:true"></td>
                </tr>
                <tr>
                <th>密码长度:</th>
                    <td>
                	  <input class="easyui-numberbox" id="length" name="length" data-options="required:true" >
                	</td>
                </tr>
                <tr>
                <th>复杂程度:</th>
                    <td >
					<select name="complex" >
						<option value="1">无限制</option>
						<option value="2">必须包含字母</option>
						<option value="3">必须包含字母+特殊字符</option>
					</select>
		  	       </td>
                </tr>
                <tr>
                <th>错误密码次数:</th>
                    <td>
                	  <input class="easyui-numberbox" id="loginAmount" name="loginAmount" data-options="required:true" >
                	</td>
                </tr>
                <tr>
                <th>密码规则:</th>
                    <td>
                	  <input class="easyui-numberbox " id="pwdRuleId" name="pwdRuleId"  data-options="required:true">
                	</td>
                </tr>
            <tr id="cz">
                <th>操作:</th>
                <td>
                	<input type="button"  onclick="submitForm()" class="button" value="保存" >
                </td>
            </tr>
          </table>
       </form>
   </div>
</div>
<script>
$(function(){
	var param = {};
	$.pmsAjax({
		url:'<c:url value="/mpass/searchEmMPassPolicy.do"/>',
		data:param,
		success:function(data){
			//console.log(data);
			if(data.code=="200"){
				var emMPassPolicy = data.data.emMPassPolicy;
				$('#mPassPolicyInfoForm').form('load', emMPassPolicy);
			}else{
				alertError(data.result);
			}	
		}
});
});

function submitForm(){
	$('#mPassPolicyInfoForm').form('submit', {
		url:'<c:url value="/mpass/updateEmMPassPolicy.do"/>',
	    onSubmit: function(param){
	    	if(!$("#mPassPolicyInfoForm").form('validate')){
	    		return false;
	    	}
	    }, 
	    success:function(data){
		    var ret = eval("("+data+")");
	     	if(ret.code=='200'){
	     		alertShow("密码规修改改成功！");
		    }else{
		    	alertError(ret.result);
			}
	    }
	});
}
</script>